<%@page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <h1>欢迎使用图书管理系统，请登录！</h1>

    <style type="text/css">
        span{
            color: red;
            font-size: 12px;
        }
    </style>

    <script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.4.1.js"></script>
</head>
<body>
<script type="text/javascript">
    $(function (){

        $("#loginBtn").click(function (){
            var loginName = $.trim($("#loginName").val());
            var loginPwd = $.trim($("#loginPwd").val());
            var loginVer = $.trim($("#loginVer").val());
            if(loginName==""){
                alert("用户名不能为空");
                return ;
            }
            if(loginPwd==""){
                alert("密码不能为空");
                return ;
            }
            if(loginVer==""){
                alert("验证码不能为空");
                return ;
            }


            var form =  document.getElementById('formId');
            form.action='${pageContext.request.contextPath}/login?method=userLogin';
            form.submit();
        });

        $("input").focus(function(){
            document.getElementById('returnMessageSpan').innerText='';
        });
    });
</script>
<hr>
    <form  id="formId" method="post">
    <div>
        账号:<input type="text" id="loginName" name="username" size="20"><br><br>
        密码:<input type="password" id="loginPwd" name="password" size="20"><span></span><br><br>
        验证码:<input type="text" id="loginVer" name="verifyCode" size="20" placeholder="字母不区分大小写"><img src="${pageContext.request.contextPath}/verifyCode?method=getVerifyCode" id="verifyCode" onclick="this.src='${pageContext.request.contextPath}/verifyCode?method=getVerifyCode&'+Math.random()" ></span><br>
        <span id="returnMessageSpan">${returnObject.message}</span><br><br>
        七天内免登录<input type="checkbox" name="loginInFree" value="free"><br><br>
        <input type="submit" id="loginBtn" value="登录"><sapn id="login"></sapn><br><br>
    </div>
    </form>
<br>
</body>
</html>
